import Vue from 'vue';
import Vuex from 'vuex';


import Axios from 'axios';

Vue.use(Vuex);

export default new Vuex.Store({
  state: {
    nightFlag: 0,
    duringDayTheme: {
      background: '#dfdfdf',
      secondaryBackground: '#f4f3f3',
      tertiaryBackground: '#bfd8d5',
      numberOneTextColor: '#000000',
      numberTwoFontColor: '#575757',
    },
    darkTheme: {
      background: '#313131',
      secondaryBackground: '#414141',
      tertiaryBackground: '#ca3e47',
      numberOneTextColor: '#e8e8e8',
      numberTwoFontColor: '#bfbfbf',
      numberThreeFontColor: '#bfbfbf',
    },
  },
  mutations: {
    themeSwitch(e, nightFlag) {
      localStorage.setItem('nightFlag', nightFlag);
      this.state.nightFlag = nightFlag;
    },
  },
  getters: {
    getTheme: (state) => {
      if (state.nightFlag == 0) {
        console.log('...');
        return state.duringDayTheme;
      }
        console.log('..');
        return state.darkTheme;
    },
  },
  actions: {
    themeSwitch(content, nightFlag) {
      content.commit('themeSwitch', nightFlag);
    },
  },
});
